package com.amigo.online.provider;

import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.solr.core.SolrTemplate;
import org.springframework.data.solr.repository.config.EnableSolrRepositories;

@Configuration
@EnableSolrRepositories
public class SolrConfig {

    @Value("${spring.data.solr.host}")
    private String host;

    @Value("${spring.data.solr.user}")
    private String solrUserCore;

    @Value("${spring.data.solr.video}")
    private String solrVideoCore;

    @Value("${spring.data.solr.music}")
    private String solrMusicCore;

    @Value("${spring.data.solr.hotword}")
    private String solrHotWordCore;

    @Bean
    public SolrClient solrClient() {
        SolrClient solrClient = new HttpSolrClient.Builder(host).build();
        return solrClient;
    }

    @Bean
    public SolrTemplate userSolrTemplate() {
        SolrTemplate template = new SolrTemplate(solrClient());
        return template;
    }
	
	/*@Bean("videoSolrTemplate")
	public SolrTemplate videoSolrTemplate() {
		SolrTemplate template = new SolrTemplate(solrClient());
		return template;
	}
	
	@Bean("musicSolrTemplate")
	public SolrTemplate musicSolrTemplate() {
		SolrTemplate template = new SolrTemplate(solrClient());
		return template;
	}
	
	@Bean("hotWordSolrTemplate")
	public SolrTemplate hotWordSolrTemplate() {
		SolrTemplate template = new SolrTemplate(solrClient());
		return template;
	}*/
}